package com.qf.lanzhou.blog.api.controller.notification;

import com.qf.lanzhou.blog.api.controller.BaseServletPost;
import com.qf.lanzhou.blog.api.pojo.entity.Notification;
import com.qf.lanzhou.blog.api.service.NotificationService;
import com.qf.lanzhou.blog.api.service.impl.NotificationServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * @author 是柠檬甜
 * @ClassName NotificationPublicServlet
 * @description 通知发布功能类
 * @date 2020/12/16 17:49
 * @modifier 是柠檬甜
 * @date 2020-12-16 17:49
 * @Version V1.0
 */
@WebServlet("/notificationPublic.do")
public class NotificationPublicServlet extends BaseServletPost {
    private NotificationService notificationService=new NotificationServiceImpl();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("UTF-8");
        resp.setContentType("text/html;charset=utf-8");
        List<Notification> listPublic = notificationService.show();
        successResultWrite(listPublic,resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
}
